<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.math.BigDecimal"%>
<%@page import="inet.util.StringTool"%>
<%@page import="lib.db.clip.Clip"%>
<%@page import="lib.util.FileTool"%>
<jsp:useBean id="clipDAO" class="lib.db.clip.ClipDAO" scope="session"/>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
	<head>
		<link rel="stylesheet" type="text/css" href="include/style.css" />
		<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
		<meta http-equiv="Content-Type" content="application/vnd.wap.xhtml+xml; charset=UTF-8" />
		<title>Tải clip</title>
	</head>
	<body>
		<%//@ include file="include/header.jsp" %>
		<% 
            String sId = request.getParameter("id");
            BigDecimal id = BigDecimal.ZERO;
            if(sId != null && StringTool.isNumberic(sId)) {
            	id = new BigDecimal(sId);
            }
            try {
            	Clip clip = clipDAO.getRow(id);
            	clip = new Clip();
	            if(clip != null) {
	            	String rootPath = "D://clip/";
	            	//byte[] content = FileTool.readFile(rootPath + clip.getUrlContent());
	            	byte[] content = FileTool.readFile(rootPath + "wapphim.net-1332040882.3gp");
	            	response.setContentType("video/3gpp");
	            	response.setHeader("Content-Length", String.valueOf(content.length));
	            	response.setHeader("Content-Disposition", "filename=\"clip.wap.vn\"");
	            	response.setContentLength(content.length);
	            	ServletOutputStream output = response.getOutputStream();
	            	output.write(content, 0,content.length);
		            output.flush();
		            output.close();
	            }
            } catch (Exception ex) {
            }
		%>
		
	</body>
</html>
